# Maintainer:
# Contributor: Dale Blount <dale@archlinux.org>
# Contributor: Manolis Tzanidakis

pkgname=razor
pkgver=2.85
pkgrel=16
pkgdesc="A distributed, collaborative, spam detection and filtering network"
arch=('x86_64')
url="http://razor.sourceforge.net"
license=('PerlArtistic')
depends=('perl-net-dns' 'perl-digest-sha1' 'perl-uri' 'perl-digest-nilsimsa' 'perl')
options=('!emptydirs')
source=("https://downloads.sourceforge.net/${pkgname}/${pkgname}-agents-${pkgver}.tar.bz2"
         razor-2.85-cosmetic-pv-fix.patch
         razor-2.85-makefile-quoting-fix.patch)
md5sums=('014d08db40187cb1316482191566b012'
         '850645e088b21845f4b6653623d59515'
         '6543caaf0a4086e65de1fb61c8dd5b7b')

prepare() {
  cd ${pkgname}-agents-${pkgver}

  patch -p1 -i ../razor-2.85-cosmetic-pv-fix.patch

  # ExtUtils::MakeMaker >= 6.99_09 has quotes around paths
  patch -p1 -i ../razor-2.85-makefile-quoting-fix.patch
}

build() {
  cd ${pkgname}-agents-${pkgver}
  perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd ${pkgname}-agents-${pkgver}
  make test
}

package() {
  cd ${pkgname}-agents-${pkgver}
  make DESTDIR="${pkgdir}" install
}
